/**
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */

package com.poltman.dscentral.login;


import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.dspace.core.Context;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zkplus.spring.SpringUtil;
import org.zkoss.zul.Groupbox;

/**
 * 
 * @author Zbigniew Ciok; z.ciok@poltman.com
 * @version $Revision: 1798 $
 *   
 * @param <Groupbox>
 * 
 */
public class LogoutDialogComposer extends SelectorComposer<Groupbox> {

	private static final long serialVersionUID = 8753351144302561349L;

	private static Logger log = Logger.getLogger(LogoutDialogComposer.class);
	
	
	@Listen("onClick = #confirmBtn")
	public void confirm() {
		HttpSession s = (HttpSession)Sessions.getCurrent().getNativeSession();
		s.invalidate();
		Sessions.getCurrent().invalidate();
		Context context = (Context) SpringUtil.getBean("context");
		context.clear();
		Executions.sendRedirect("/index.jsp");
	}

}

